package tpdisenio2009.model.beans;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author DeuterioX
 */
@Entity
@Table(name = "soccer_match")
@NamedQueries({
    @NamedQuery(name = "SoccerMatch.findAll", query = "SELECT s FROM SoccerMatch s")})
public class SoccerMatch implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final String PLAYED_MATCH = "Jugado";
    public static final String NON_PLAYED_MATCH = "No-Jugado";
    public static final String SUSPENDED_MATCH = "Suspendido";
    public static final String POSTPONED_MATCH = "Postergado";

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;

    @Basic(optional = false)
    @Column(name = "state", nullable=false)
    private String state;

    @JoinColumn(name = "tournament_date_id", referencedColumnName = "id", nullable=false)
    @ManyToOne(optional = false)
    private TournamentDate tournamentDate;

    @JoinColumn(name = "real_team_local_id", referencedColumnName = "id", nullable=false)
    @ManyToOne(optional = false)
    private RealTeam realTeamLocal;

    @JoinColumn(name = "real_team_visitor_id", referencedColumnName = "id", nullable=false)
    @ManyToOne(optional = false)
    private RealTeam realTeamVisitor;

    public SoccerMatch() {
    }

    public SoccerMatch(Integer id) {
        this.id = id;
    }

    public SoccerMatch(Integer id, String state) {
        this.id = id;
        this.state = state;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public TournamentDate getTournamentDate() {
        return tournamentDate;
    }

    public void setTournamentDate(TournamentDate tournamentDate) {
        this.tournamentDate = tournamentDate;
    }

    public RealTeam getRealTeamLocal() {
        return realTeamLocal;
    }

    public void setRealTeamLocal(RealTeam realTeamLocal) {
        this.realTeamLocal = realTeamLocal;
    }

    public RealTeam getRealTeamVisitor() {
        return realTeamVisitor;
    }

    public void setRealTeamVisitor(RealTeam realTeamVisitor) {
        this.realTeamVisitor = realTeamVisitor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SoccerMatch)) {
            return false;
        }
        SoccerMatch other = (SoccerMatch) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tpdisenio2009.model.beans.SoccerMatch[id=" + id + "]";
    }

}
